package com.cpsoft.androiddemo.gson;

import android.annotation.TargetApi;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.Target;
import com.cpsoft.androiddemo.R;
import com.google.gson.Gson;

import butterknife.Bind;
import butterknife.ButterKnife;

public class GsonActivity extends AppCompatActivity {

    @Bind(R.id.text)
    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gson);
        ButterKnife.bind(this);

        User user = new User();
        user.setAge(11);
        user.setPassword("1111111");
        user.setUsername("admin");

        Gson gson = new Gson();
        String str = gson.toJson(user);

        textView.setText(str);
    }
}
